﻿using UnityEngine;
using UnityEngine.UI;

public static class UIUtils
{
    public static Vector2 HalfV2 = new Vector2(0.5f, 0.5f);

    public static void SetUIFullScreen(RectTransform ui)
    {
        ui.anchoredPosition3D = Vector3.zero;
        ui.localScale = Vector3.one;

        ui.offsetMin = Vector2.zero;
        ui.offsetMax = Vector2.zero;
        ui.sizeDelta = Vector2.zero;
        ui.anchorMin = Vector2.zero;
        ui.anchorMax = Vector2.one;
        ui.pivot = HalfV2;
    }

    public static void SetUIStandardScreen(RectTransform ui)
    {
        ui.anchoredPosition3D = Vector3.zero;
        ui.localScale = Vector3.one;

        ui.offsetMin = Vector2.zero;
        ui.offsetMax = Vector2.zero;
        ui.sizeDelta = AdaptiveConst.StandardResolution;
        ui.anchorMin = HalfV2;
        ui.anchorMax = HalfV2;
        ui.pivot = HalfV2;
    }

    public static Rect GetUISafeAreaAnchors()
    {
        float left, bottom, right, top;
        left = 0;
        bottom = 0;
        right = 0;
        top = 0;
        return new Rect(left, bottom, right, top);
    }

}